package com.wjp.dinosaur.controller;

import com.wjp.dinosaur.service.LoginService;
import com.wjp.dinosaur.vo.Result;
import com.wjp.dinosaur.vo.parm.LoginParms;
import com.wjp.dinosaur.vo.parm.RegisterParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
public class LoginController {

    @Autowired
    private LoginService loginService;

    @ApiOperation("登录")
    @PostMapping("login")
    public Result login(@RequestBody LoginParms loginParms){
        return loginService.login(loginParms);
    }

    @ApiOperation("注销")
    @GetMapping("logout")
    public Result logout(){
        return loginService.loginout();
    }

    @ApiOperation("注册")
    @PostMapping("register")
    public Result register(@RequestBody RegisterParams registerParams){
        return loginService.register(registerParams);
    }
}
